|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
00001 00020 #ifndef CENTRAL_ACCEL_AL_H_ 00021 #define CENTRAL_ACCEL_AL_H_ 00022 00023 /* 00024 ************************************************************** 00025 * Defines, Macros and Typedefs 00026 **************************************************************/ 00027 /*** Constant Macros ***/ 00028 /* Default Yes and No defines */ 00029 #ifndef TRUE 00030 #define TRUE (1u) 00031 #endif 00032 #ifndef CLEAR 00033 #define CLEAR (0u) 00034 #endif 00035 #ifndef BITS_IN_NIBBLE 00036 #define BITS_IN_NIBBLE (4u) 00037 #endif 00038 #ifndef BITS_IN_BYTE 00039 #define BITS_IN_BYTE (8u) 00040 #endif 00041 #ifndef BYTES_IN_16 00042 #define BYTES_IN_16 (2u) 00043 #endif 00044 #ifndef BYTES_IN_32 00045 #define BYTES_IN_32 (4u) 00046 #endif 00047 00048 #ifndef BIT_DEFINITION 00049 #define BIT_DEFINITION 00050 #define BIT0 (1u << 0u) 00051 #define BIT1 (1u << 1u) 00052 #define BIT2 (1u << 2u) 00053 #define BIT3 (1u << 3u) 00054 #define BIT4 (1u << 4u) 00055 #define BIT5 (1u << 5u) 00056 #define BIT6 (1u << 6u) 00057 #define BIT7 (1u << 7u) 00058 #define BIT8 (1u << 8u) 00059 #define BIT9 (1u << 9u) 00060 #define BIT10 (1u << 10) 00061 #define BIT11 (1u << 11) 00062 #define BIT12 (1u << 12) 00063 #define BIT13 (1u << 13) 00064 #define BIT14 (1u << 14) 00065 #define BIT15 (1u << 15) 00066 #define BIT16 (1u << 16) 00067 #define BIT17 (1u << 17) 00068 #define BIT18 (1u << 18) 00069 #define BIT19 (1u << 19) 00070 #define BIT20 (1u << 20) 00071 #define BIT21 (1u << 21) 00072 #define BIT22 (1u << 22) 00073 #define BIT23 (1u << 23) 00074 #define BIT24 (1u << 24) 00075 #define BIT25 (1u << 25) 00076 #define BIT26 (1u << 26) 00077 #define BIT27 (1u << 27) 00078 #define BIT28 (1u << 28) 00079 #define BIT29 (1u << 29) 00080 #define BIT30 (1u << 30) 00081 #define BIT31 (1u << 31) 00082 #endif 00083 00084 /* Following define can be set to MESQUITE or SYCAMORE depending on the board */ 00085 #define CURRENT_CA SYCAMORE 00086 #define CURRENT_ACCEL_MODE 3u 00087 00088 #ifndef STATUS_CA_FAILED 00089 #define STATUS_CA_FAILED (BIT27 | BIT26) 00090 #endif 00091 00092 /*** Function Macros ***/ 00093 #ifndef N_ELEMENTS 00094 #define N_ELEMENTS(X) (sizeof(X)/sizeof(*(X))) 00095 #endif 00096 00097 /* The following define will mask the existence of Y as a true fn. We are */ 00098 /* really calling the X function. */ 00099 #define u32fnExtractY u32fnExtractX 00100 00101 /*** Enums ***/ 00102 00103 00104 /*** TypeDefs ***/ 00105 00106 /* 00107 ************************************************************** 00108 * Declarations 00109 **************************************************************/ 00110 /*** Global ***/ 00111 /*** Static ***/ 00112 00113 /*** Constant ***/ 00114 extern const uint16_t cau16MMA6800ResetSettings[]; 00115 extern const uint16_t cau16MMA6800InitSettings[]; 00116 extern const uint8_t cu8SizeofMMA6800ResetSettings; 00117 extern const uint8_t cu8SizeofMMA6800InitSettings; 00118 00119 /* 00120 ************************************************************** 00121 * Function Prototypes 00122 **************************************************************/ 00123 /* 00124 ****************************************************************************** 00125 * 00126 * Function: vfnCAPreSchedulerInit() 00127 * 00128 */ 00137 void vfnCAPreSchedulerInit(void); 00138 /* 00139 ****************************************************************************** 00140 * 00141 * Function: u8fnCAInit() 00142 * 00143 */ 00166 uint32_t u32fnCAInit(void); 00167 /* 00168 ****************************************************************************** 00169 * 00170 * Function: u32fnCAScheduleAccelXY() 00171 * 00172 */ 00180 uint32_t u32fnCAScheduleAccelXY(uint16_t* pu16RawDestination); 00181 /* 00182 ****************************************************************************** 00183 * 00184 * Function: u32fnCAScheduleAccelX() 00185 * 00186 */ 00194 uint32_t u32fnCAScheduleAccelX(uint16_t* pu16RawDestination); 00195 /* 00196 ****************************************************************************** 00197 * 00198 * Function: u32fnCAScheduleAccelY() 00199 * 00200 */ 00208 uint32_t u32fnCAScheduleAccelY(uint16_t* pu16RawDestination); 00209 /* 00210 ****************************************************************************** 00211 * 00212 * Function: u32fnCAExtractXY() 00213 * 00214 */ 00225 uint32_t u32fnCAExtractXY(uint16_t* pu16RawSource, uint16_t* pu16FilteredXY); 00226 /* 00227 ****************************************************************************** 00228 * 00229 * Function: u32fnCAExtractX() 00230 * 00231 */ 00241 uint32_t u32fnCAExtractX(uint16_t* pu16RawSource, uint16_t* pu16FilteredX); 00242 /* 00243 ****************************************************************************** 00244 * 00245 * Function: u32fnCAInitSelfTest() 00246 * 00247 */ 00267 uint32_t u32fnCAInitSelfTest(void); 00268 /* 00269 ****************************************************************************** 00270 * 00271 * Function: u32fnCASelfTest() 00272 * 00273 */ 00292 uint32_t u32fnCASelfTest(const uint8_t cu8Axis); 00293 #endif /* CENTRAL_ACCEL_AL_H_ */